<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script>
        var arr = [1,2,3,4,5]
        // for循环，有计数器，在循环前会被初始化
        for(var i = 0 ;i<arr.length;i++){
            console.log(arr[i])
        }
        var arr1 = {
            name:'linda',
            age:18
        }
        // for in用来枚举对象的属性名
        for(var i in arr1){
            console.log(i,arr1[i],'arr1')
        }
        for(var i in arr){
            console.log(i,arr[i],'arr')
        }
        //for of用来枚举"可迭代对象"的属性值
        // for(var i of arr1){
        //     console.log(i,arr1[i],'arr1') //报错  TypeError: arr1 is not iterable   对象默认是不可迭代的
        // }
        for(var i of arr){
            console.log(i,'arr')
        }
    </script>
</head>
<body>
    
</body>
</html>
